#!/usr/bin/python
# coding=gbk
from os import listdir
dir=''
files=listdir(dir)
for f in files:
	print '-'*20
	print f
	if not '.cue' in f:
		continue
	g=file(f,'r')
	l=g.readlines()
	for i in range(0,10):
		if l[i][0:4]=='FILE':break
	print 'before:\n'+l[i]
	f=l[i][6:l[i].find('WAVE')-2]
	f=f.replace(' ','.')
	l[i]='FILE "'+f+'" WAVE\n'
	f+='.cue'
	print 'after:\n'+l[i]
	print 'new file:\n'+f
	g=file(f,'w')
	for line in l:
		g.write(line)
	g.close()
	#raw_input()